/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.promotion;

import com.enation.app.javashop.client.promotion.ExchangeGoodsClient;
import com.enation.app.javashop.core.client.fallback.promotion.ExchangeGoodsClientFallbackFactory;
import com.enation.app.javashop.core.client.fallback.system.ValidatorClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.goods.dto.ExchangeClientDTO;
import com.enation.app.javashop.model.promotion.exchange.dos.ExchangeDO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author fk
 * @version v2.0
 * @Description: 积分兑换
 * @date 2018/8/21 15:13
 * @since v7.0.0
 */
@FeignClient(value = "promotion-service", fallbackFactory = ExchangeGoodsClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface ExchangeGoodsClientFeignImpl extends ExchangeGoodsClient {

    /**
     * 添加积分兑换
     *
     * @param dto 积分兑换
     * @return ExchangeSetting 积分兑换
     */
    @Override
    @RequestMapping(value = "/client/exchange/add", method = RequestMethod.POST)
    ExchangeDO add(@RequestBody ExchangeClientDTO dto);

    /**
     * 修改积分兑换
     *
     * @param dto 商品DTO
     * @return ExchangeSetting 积分兑换
     */
    @Override
    @RequestMapping(value = "/client/exchange/edit", method = RequestMethod.POST)
    ExchangeDO edit(@RequestBody ExchangeClientDTO dto);

    /**
     * 查询某个商品的积分兑换信息
     *
     * @param goodsId
     * @return
     */
    @Override
    @RequestMapping(value = "/client/exchange/{goods_id}", method = RequestMethod.GET)
    ExchangeDO getModelByGoods(@PathVariable("goods_id") Long goodsId);

    /**
     * 删除某个商品的积分兑换信息
     * @param goodsId
     * @return
     */
    @Override
    @RequestMapping(value = "/client/exchange/{goods_id}/del", method = RequestMethod.POST)
    void del(@PathVariable("goods_id")Long goodsId);

}
